"""
@Time    : 2025/7/23 14:20
@Author  : white.tie
@File    : 挂载FASTAPI应用.py
@Desc    : 
"""
import uvicorn
from fastapi import FastAPI

app = FastAPI()

@app.get("/app")
def get_app():
    return {"message": "Hello World from main app"}

subapi = FastAPI()

@subapi.get("/sub")
def get_sub():
    return {"message": "Hello World from sub api"}

app.mount("/subapi", subapi)

if __name__ == '__main__':
    uvicorn.run(app,host="0.0.0.0",port=8060)
    # 测试接口
    # http://127.0.0.1:8060/subapi/sub
    # http://127.0.0.1:8060/app